var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.enterpriseInfo = function(req, res) {
    use(["public/javascripts/enterpriseInfo/init.js", "public/javascripts/service/enterpriseInfoService.js"], function(PageComponent, enterpriseInfoService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");
        enterpriseInfoService.getEnterpriseInfo({headers: req.headers}, function (result) {
            storage["enterpriseInfo"] = result.data;
            switch (result.data.userType) {
                case 1:
                    storage["enterpriseInfo"].userTypeValue = '物流';
                    break;
                case 2:
                    storage["enterpriseInfo"].userTypeValue = '贸易';
                    break;
                default:
                    storage["enterpriseInfo"].userTypeValue = '物流/贸易';
                    break;
            }
            PageComponent = React.createFactory(PageComponent);
            renderEngin.call(res, 'enterpriseInfo', PageComponent, storage);
        });
    });
}